package com.my.holder;

import io.netty.channel.ChannelHandlerContext;

/**
 * @author WangLuoXin
 * &#064;Date 2024/9/14  10:42
 **/
public class ContextHolder {
    private static final ThreadLocal<ChannelHandlerContext> threadLocal = new ThreadLocal<>();

    public static ChannelHandlerContext getContext() {
        return threadLocal.get();
    }

    public static void setContext(ChannelHandlerContext ctx) {
        threadLocal.set(ctx);
    }

    public static void removeContext() {
        threadLocal.remove();
    }

}
